#include "epollServer.hpp"
#include <memory>

using namespace std;

string handlerMessage(const string &request)
{
    return "处理数据" + request;
}

static void Usage(string str)
{
    cout << "Usage: " << str << " local_port" << endl;
}

int main(int argc, char *argv[])
{
    if (argc != 2)
    {
        Usage(argv[0]);
        exit(USAGE_ERR);
    }

    uint16_t port = atoi(argv[1]);

    unique_ptr<Server> epollsvr(new Server(port, handlerMessage));
    epollsvr->initServer();
    epollsvr->start();

    return 0;
}